import { BaseModel } from '@/common/base/base.model';
import { Column, Entity, Index } from 'typeorm';
import { EvaluationProjectType } from "common/utils/data";

@Entity('EVALUATION_PROJECT', {
  synchronize: false,
}) // 评测项目。这个名字如果叫TEST_PROJECT是最好的，现在改不过来了
export class EvaluationProjectModel extends BaseModel {
  @Column({
    comment: '名称',
    type: 'varchar',
    length: 250,
  })
  @Index('EVALUATION_PROJECT.name', {
    unique: true,
  })
  name: string;

  @Column({
    comment: 'code',
    type: 'varchar',
    length: 50,
  })
  @Index('EVALUATION_PROJECT.code', {
    unique: true,
  })
  code: string;

  @Column({
    comment: '描述',
    type: 'varchar',
    length: 500,
    default: '',
  })
  desc: string;

  @Column({
    comment: '排序',
    type: 'int',
    default: 1,
  })
  sort: number;

  /**
   * needTarget 是否需要target这根线
   * xMin,xMax 横轴范围大小
   * yMin,yMax 纵轴范围大小
   * log 是否是对数轴
   * */
  @Column({
    comment: '规则',
    type: 'json',
    default: {},
  })
  rule: object;

  @Column({
    comment: '类型',
    type: 'varchar',
    length: 50,
    default: EvaluationProjectType.DIGITAL,
  })
  type: EvaluationProjectType;
}
